<?php


namespace frontend\controllers\cyf;


use frontend\controllers\common;
use logic\cyf\DiscussLogic;
use yii\web\Controller;
use yii\web\Request;

class DiscussController extends Controller
{
    /**
     * 商品评论
     * @param Request $request
     * @return false|string
     * @name cyf
     */
    public function actionDisCussion(Request $request)
    {
        try {
            if(!$request->isGet) return common::fail('20005','null','请求方式错误');
            $goods_id = $request->get('goods_id');
            if(!is_numeric($goods_id)|| empty($goods_id)) return common::fail(20006,'null','参数错误');
            $goodsDis = DiscussLogic::goodsDis($goods_id);
            if(!$goodsDis) throw new \Exception('操作失败');
            return common::success('0',$goodsDis,'操作成功');
        }catch (\Exception $exception){
            return common::fail(20007,'null',$exception->getMessage());
        }
    }
}